import request from '@/utils/request'
import apis from './'

/**
 * 三天未开单列表
 * @returns {AxiosPromise}
 */
export function getUnpaid (parameter) {
  return request({
    url: apis.AdviserIndex,
    method: 'get',
    params: parameter
  })
}

export function getPaid (parameter) {
  return request({
    url: apis.PaidCustomer,
    method: 'get',
    params: parameter
  })
}

export function getBusiness (parameter) {
  return request({
    url: apis.AdviserBusiness,
    method: 'get',
    params: parameter
  })
}

export function getReceive (type) {
  return request({
    url: `${apis.ReceiveWork}?resource_type=${type}`,
    method: 'get'
  })
}

export function getReceiveWorkSh (type) {
  return request({
    url: `${apis.ReceiveWorkOld}?resource_type=${type}`,
    method: 'get'
  })
}

export function getReceiveVip (type) {
  return request({
    url: `${apis.ReceiveWorkVIP}?resource_type=${type}`,
    method: 'get'
  })
}

export function saveReceive (data) {
  return request({
    url: apis.SaveReceive,
    method: 'post',
    data: data
  })
}

export function getCall (id) {
  return request({
    url: `${apis.CallWork}?customer_id=${id}`,
    method: 'get'
  })
}

export function saveCall (id, data) {
  return request({
    url: `${apis.CallWork}?customer_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getData () {
  return request({
    url: apis.IndexData,
    method: 'get'
  })
}

export function getDataDetail (type) {
  return request({
    url: `${apis.DataDetail}?type=${type}`,
    method: 'get'
  })
}

export function signQuestionCustomer (id) {
  return request({
    url: `${apis.QuestionCustomer}?customer_id=${id}`,
    method: 'get'
  })
}

export function getAddTrademark () {
  return request({
    url: apis.AddTrademark,
    method: 'get'
  })
}

export function postAddTrademark (data) {
  return request({
    url: apis.AddTrademark,
    method: 'post',
    data: data
  })
}

// 大客户模块
export function getOtherCustomer (parameter) {
  return request({
    url: apis.OtherList,
    method: 'get',
    params: parameter
  })
}

export function getOtherData () {
  return request({
    url: apis.OtherData,
    method: 'get'
  })
}

export function getEditWechat (id) {
  return request({
    url: `${apis.OtherAddWechat}?customer_id=${id}`,
    method: 'get'
  })
}

export function getCreateWechat (id) {
  return request({
    url: `${apis.CreateWechat}?cid=${id}`,
    method: 'get'
  })
}

export function postEditWechat (data, id) {
  return request({
    url: `${apis.OtherAddWechat}?customer_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getCategory () {
  return request({
    url: `${apis.GetCategory}?type=get_count`,
    method: 'get'
  })
}

export function getBusinessCount (id) {
  return request({
    url: `${apis.GetCategory}?category=${id}`,
    method: 'get'
  })
}

export function getChart (id) {
  return request({
    url: `${apis.GetChart}?business_id=${id}`,
    method: 'get'
  })
}

export function getMonthData (month) {
  return request({
    url: `${apis.GetBusinessByMonth}?month=${month}`,
    method: 'get'
  })
}

export function getBusinessList (parameter) {
  return request({
    url: apis.GetBusinessList,
    method: 'get',
    params: parameter
  })
}
